"use server";
import prisma from "@/lib/prisma";
import { Prisma } from "../../generated/prisma";
export const getUserByEmail = async <T extends Prisma.UserOmit>(email: string, omit?: T) => {
  return await prisma.user.findUnique({ where: { email: email }, omit });
};

export const getUserByUserId = async <T extends Prisma.UserOmit>(id: string, omit?: T) => {
  return await prisma.user.findUnique({ where: { id: id }, omit });
};

export const getUserByMobile = async <T extends Prisma.UserOmit>(mobile: string, omit?: T) => {
  if (!mobile) return null;
  return await prisma.user.findUnique({ where: { mobile: mobile }, omit });
};

